#include<bits/stdc++.h>
using namespace std;

int main () {
    int n;
    cin >> n;
    n = n == 5 ? 7 : (n + 2) % 7;
    cout << n << endl;
    return 0;
}